schemes

fun schemes(configuration: SchemesDsl.() -> Unit)

Associates the given URL schemes with the callbacks, so that all URL requests with the given schemes will be intercepted before they are sent out.

Chromium can treat each scheme as:

Standard: the schemes in the standard format described in RFC 3986 Section 3. The syntax for standard scheme URLs must be in the following form:

[scheme]://[username]:[password]@[host]:[port]/[path]

Note: the non-standard URLs with the standard scheme will be canonicalized to scheme://host/path. For example, scheme:host/path will be canonicalized to scheme://host/path.

Referrer: the schemes that are allowed for referrers.

Secure: the schemes that are treated with the same security rules as those applied to "https" URLs.

Local: the schemes that normal pages cannot link to or access (i.e., with the same security rules as those applied to “file” URLs). Normal pages cannot link to or access local URLs. Also, by default, local URLs can only perform XMLHttpRequest calls to the same URL (origin + path) that originated the request.

No Access: the schemes that cause pages loaded with them to not have access to pages loaded with any other URL scheme.

CORS Enabled: the schemes that can sent CORS requests.

Web Storage: the schemes that can be used by web pages to store data using local storage.

CSP Bypassing: the schemes that can bypass the Content-Security-Policy (CSP) checks.

For example, HTTPS is treated as standard, referrer, secure, CORS enabled, and web storage.

Not any scheme can be added and intercepted. The following schemes cannot be intercepted, so you will get IllegalArgumentException if you try to add them:

  • about

  • blob

  • content

  • cid

  • data

  • file

  • filesystem

  • ftp

  • javascript

  • mailto

  • quic-transport

  • tel

  • ws

  • wss

  • devtools

  • chrome

  • chrome-error

  • chrome-distiller

  • chrome-untrusted

  • chrome-guest

  • chrome-search

  • chrome-extension

  • chrome-native

  • view-source

  • externalfile

  • googlechrome


Associates the given URL schemes with the callbacks, so that all URL requests with the given schemes will be intercepted before they are sent out.

See also